#include"proceseBar.h"
#include<unistd.h>
#include<string.h>
char ch[102] = {0};
void action()
{
	int rate = 0;
	while(rate<=100)
	{
		proceseBar2(rate);
		usleep(1000000);
		rate+=10;
	}
	printf("\n");
}
void proceseBar2(int rate)
{
	char*row = "|/-\\";
	memset(ch,'-',rate);
		if(rate< 100)
			ch[rate] = '>';
	int len = strlen(row);
		printf("[%-100s][%d%%][%c]\r",ch,rate,row[rate%len]);
		fflush(stdout);
		ch[rate++] = FLOG;
}
void proceseBar()
{
	char ch[102] = {0};
	int cnt = 0;
	char*row = "|/-\\";
	int len = strlen(row);
	while(cnt<=100)
	{

		printf("[%-100s][%d][%c]\r",ch,cnt,row[cnt%len]);
		fflush(stdout);
		ch[cnt++] = FLOG;
		if(cnt< 100)
		ch[cnt] = '>';
      	usleep(100000);
	}
	printf("\n");
}
